<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <ul></ul>

    <script src="../js/promise_ajax.js"></script>
    <script src="../js/api_v2.js"></script>
    <script>

        let orderName = 'goods_id';
        let orderType = 1;
        let kw = '';
        let num = 4;
        let page = 1;


        const oUl = document.querySelector('ul');


        render();   // 异步的



        // 事件委托
        // const oLis = document.querySelectorAll('li');
        // console.log(oLis);    // 拿不到元素的





        async function render() {
            const res = await list({
                orderName,
                orderType,
                num,
                kw,
                page
            });
            console.log(res);
            let html = '';

            res.data.forEach(v => {
                html += '<li>1</li>';
            })
            oUl.innerHTML = html;
        }

    </script>

</body>

</html>